local skel = fk.CreateSkill{
  name = "lb__chuyuan",
  tags = {Skill.Wake}
}

Fk:loadTranslationTable{
  ["lb__chuyuan"] = "初愿",
  [":lb__chuyuan"] = "<b>觉醒技</b>，当首张「<b>星颂</b>」牌进入弃牌堆后，若牌堆已洗牌，你增加1点体力上限并令所有角色回满体力值。",
  
  ["@$lb__chuyuan"] = "初愿",

  ["$lb__chuyuan1"] = "循此苦旅，得见群星。",
  ["$lb__chuyuan2"] = "自省后的瞭望，并非幻梦一场。",
}

skel:addEffect(fk.AfterCardsMove, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and player:usedSkillTimes(skel.name, Player.HistoryGame) == 0
  end,
  can_wake = function (self, event, target, player, data)
    if (not player:hasSkill(skel.name)) or (#player:getTableMark("@$lb__chuyuan") == 0) or (player:getMark("ShuffleCount") == 0) then return end
    for _, move in ipairs(data) do
      if move.toArea == Card.DiscardPile then
        for _, info in ipairs(move.moveInfo) do
          return table.contains(player:getTableMark("@$lb__chuyuan"),info.cardId)
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:changeMaxHp(player,1)
    for _, p in ipairs(room:getAlivePlayers()) do
      if p:isWounded() then
        room:recover{
          who = p,
          num = p.maxHp - p.hp,
          skillName = skel.name,
          recoverBy = player,
        }
      end
    end
  end,
})

return skel